#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName :cp2_2.23.py
# @Time     :2023/9/3 09:59
# @Author   :Ash
import numpy
from time import perf_counter as pc

if __name__ == "__main__":
    a = numpy.arange(1000)
    numpy.savetxt('../assets/floats-10M-lines.txt', a, delimiter=',')

    floats = numpy.loadtxt('../assets/floats-10M-lines.txt')
    print(floats[-3:])
    floats *= .5
    print(floats[-3:])

    t0 = pc()
    floats /= 3
    print(pc() - t0)
    numpy.save('../assets/floats-10M', floats)
    floats2 = numpy.load('../assets/floats-10M.npy', 'r+')
    floats2 *= 6
    print(floats2[-3:])
